<!DOCTYPE html>
<html>
<head>
    <title>礼物 </title>
    <#include "/header.html">
    <link rel="stylesheet" href="${request.contextPath}/statics/plugins/webuploader/webuploader.css">
    <script src="${request.contextPath}/statics/plugins/webuploader/webuploader.js"></script>
</head>
<body>
<div id="webpage" class="jq-td-valign" v-cloak>
    <div v-show="appearance.showList">
        <div v-show="appearance.showControllBar" class="grid-btn">
            <span v-show="appearance.showSearchForm">
                <div class="form-group col-sm-2">
                    <input type="text" class="form-control" v-model="q._keyword" @keyup.enter="query" placeholder="关键字">
                </div>
                <a class="btn btn-default" @click="query">查询</a>
            </span>

            <#if shiro.hasPermission("app:gift:save")>
            <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
            </#if>
        <#if shiro.hasPermission("app:gift:update")>
        <a class="btn btn-primary" @click="update(null,$event)"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
        </#if>
    <#if shiro.hasPermission("app:gift:delete")>
    <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
    </#if>
</div>
<table id="jqGrid"></table>
<div id="jqGridPager"></div>
</div>

<div v-if="!appearance.showList" class="panel panel-default">
    <div class="panel-heading">{{title}}</div>
    <form class="form-horizontal">

        <div class="form-group">
            <div class="col-sm-2 control-label">礼物分组</div>
            <div class="col-sm-10">
                <select class="form-control" v-model="gift.groupName">
                    <option value="">全部场景</option>
                    <option v-for="(value,key) in config.groups" :value="key">{{value}}</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">礼物分类</div>
            <div class="col-sm-10">
                <select class="form-control" v-model="gift.category">
                    <option v-for="(value,key) in config.category" :value="key">{{value}}</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">礼物类型</div>
            <div class="col-sm-10">
                <select class="form-control" v-model="gift.type">
                    <option v-for="(value,key) in config.types" :value="key">{{value}}</option>
                </select>

            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">礼物标记</div>
            <div class="col-sm-10">
                <select class="form-control" v-model="gift.mark">
                    <option v-for="(value,key) in config.mark" :value="key">{{value}}</option>
                </select>

            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">编码</div>
            <div class="col-sm-10">
                <input type="text" class="form-control" v-model="gift.code" placeholder="编码"/>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">礼物名称</div>
            <div class="col-sm-10">
                <input type="text" class="form-control" v-model="gift.name" placeholder="礼物名称"/>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">礼物资源</div>
            <div class="col-sm-10">
                <input type="text" class="form-control" v-model="gift.picUrl" placeholder="礼物资源"/>
                <div style="padding-top:10px;">
                    <web-uploader ref="uploader" v-on:response="uploadResonse"
                                  action="../../sys/oss/upload?type=gift"></web-uploader>
                </div>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-2 control-label">礼物价格</div>
            <div class="col-sm-10">
                <input type="text" class="form-control" v-model="gift.price" placeholder="礼物价格"/>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">描述</div>
            <div class="col-sm-10">
                <input type="text" class="form-control" v-model="gift.descript" placeholder="描述"/>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">排序</div>
            <div class="col-sm-10">
                <input type="text" class="form-control" v-model="gift.displayOrder" placeholder="排序"/>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">有效期 单位：秒</div>
            <div class="col-sm-10">
                <input type="text" class="form-control" v-model="gift.dateLimit" placeholder="有效期 单位：秒"/>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label">添加时间</div>
            <div class="col-sm-10">
                <input type="text" class="form-control" v-model="gift.adddate" placeholder="添加时间"/>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-2 control-label"></div>
            <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
            &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
        </div>
    </form>
</div>
</div>
<script>
    set_grid_column_formatter('app/gift/picUrl', function (cellValue, options, rowData) {
        return str_format('<img src="{0}" class="row-image" />', cellValue);
    })


</script>
<script src="${request.contextPath}/statics/js/modules/app/gift.js?_${.now?long}"></script>
</body>
</html>